<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/11/19
  Time: 15:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang='zh-CN'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width,initial-scale=1.0'>
    <title>添加商品</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/header.css">
    <link rel="stylesheet" href="css/addProduct.css">
    <script src="js/jquery-3.6.0.min.js">
    </script>
    <script type="text/javascript">
        $(document).ready(function(){
            $.ajax({
                url:"${pageContext.request.contextPath}/type?method=findAll",
                type:"GET",
                dataType:"json",
                success:function(data){
                    for(var i in data){
                        var a = $("<a href='${pageContext.request.contextPath}/product?method=show&tid="+data[i].tid+"'>"+data[i].tname+"</a>");
                        $("#goodsType").append(a);
                        var b = $("|<input type=\"radio\" name=\"tid\" name=\"pid\" value=\"${data[i].tid}\">"+data[i].tname);
                        $("#myRadio").append(b);

                    }
                },
                error:function(){
                    alert("失败");
                }
            })
        })
    </script>
</head>

<body>
<div id="top">
    <div id="topdiv">
            <span>
                <a href="index.jsp" id="a_top" target="_blank">Myshopping商城</a>
            </span>

        <span style="float:right">
           		<c:if test="${empty loginUser}">
                    <a href="login.jsp" id="a_top">登录</a>
                    <li>|</li>
                    <a href="register.jsp" id="a_top">注册</a>
                </c:if>
       			<c:if test="${not empty loginUser}">
                    <a href="user?method=selectUserByUid" id="a_top">${loginUser.username}</a>
                    <li>|</li>
                    <a href="user?method=logOut" id="a_top">注销</a>
                    <li>|</li>
                    <a href="order?method=show" id="a_top">我的订单</a>
                    <li>|</li>
                    <a href="address?method=show" id="a_top">地址管理</a>
                </c:if>
                <a href="${pageContext.request.contextPath}/cart?method=show&uid=${loginUser.uid}" id="shorpcar">购物车</a>
            </span>
    </div>
</div>
<div id="second">
    <a href="index.jsp" id="seimg" style=" margin-top:23px;"><img id="logo" src="image/logo.png" width="119.5" height="59"/></a>
    <p id="goodsType">
        <!-- 根据ajax 回调函数 填写数据 到此id中 -->
    </p>
    <form class="form-inline pull-right" style="margin-top: 40px;margin-right: 10px;" action="/product?method=likeshow&" method="post">

        <div class="form-group">
            <input type="text" class="form-control" style="width: 400px" name="str" placeholder="搜索一下好东西...">
        </div>
        <button type="submit" class="btn btn-warning"><span class="glyphicon glyphicon-search"></span>&nbsp;&nbsp;搜索</button>
    </form>
</div>
<div class="big-box">
    <form action="">
        <table>
            <tr>
                <th>商品类别：</th>
                <td>
                    <div id="myRadio"></div>
                    |
                </td>
            </tr>
            <tr>
                <th>商品名称：</th>
                <td><input type="text" class="input" name="pname"></td>
            </tr>
            <tr>
                <th>上传图片：</th>
                <td><input type="file" name="pimage"></td>
            </tr>
            <tr>
                <th>商品价格：</th>
                <td><input type="text" class="input" name="pprice"></td>
            </tr>
            <tr>
                <th>商品热销程度：</th>
                <td><input type="number" class="input" name="pstate"></td>
            </tr>
            <tr>
                <th>商品详细信息介绍：</th>
                <td><textarea class="textarea" name="pinfo"></textarea></td>
            </tr>
            <tr>
                <th><input type="reset" class="button"></th>
                <th><input type="submit" class="button"></th>
            </tr>
        </table>
    </form>
</div>

</body>

</html>
